CentOS 6
Sponsored Link

Install Python 2.7
2016/07/31
 
The version of Python in CentOS 6 repository is 2.6 but Install 2.7 with RPM package if you need.
[1] It's possible to install from CentOS SCLo Software Collections.
It's OK to install it even if 2.6 is already installed because 2.7 is located on another PATH.
# install from SCLo

[root@dlp ~]#
yum --enablerepo=centos-sclo-rh -y install python27
[2] Packages from Software Collections are installed uder the /opt directory.
To use it, Load environment variables like follows.
# load environment variables

[root@dlp ~]#
scl enable python27 bash
[root@dlp ~]#
python -V

Python 2.7.8
[root@dlp ~]#
which python

/opt/rh/python27/root/usr/bin/python
[3] If you'd like to enable 2.7 automatically at login time, configure like follows.
[root@dlp ~]#
vi /etc/profile.d/python27.sh
# create new

#!/bin/bash

source /opt/rh/python27/enable
export X_SCLS="`scl enable python27 'echo $X_SCLS'`"
 
Tweet